<?php
class Application_Form_Login extends Zend_Form
{
    public function init()
    {
        $this->setAction("/login");        
        $this->setName("login");
        $this->setMethod('post');
  		 

        
        //quizas la salt da problemas para loguearse a determinadas personas        
        $token = new Zend_Form_Element_Hash('token');
        //$token->setSalt(md5(uniqid(rand(), TRUE)));
        $token->setSalt('hola');
        $token->setTimeout(60);
        //$this->addElement($token);
             
                                                    
        $this->addElement('text', 'username', array(
            'filters'    => array('StringTrim'),
            'required'   => true,
            'label'      => 'Usuario:',
        ));

        $this->addElement('password', 'password', array(
            'filters'    => array('StringTrim'),
            'required'   => true,
            'label'      => 'Password:',
        ));
        
        
       $server=Zend_Controller_Front::getInstance()->getRequest()->getServer('SERVER_NAME');

       if($server!='172.19.4.136'){
       
           $captcha= new Zend_Form_Element_Captcha('captcha', array(
                        'label' => "Código Verificación",
                        'captcha' => array(
                            'captcha' => 'image',
                            'font'=>PUBLIC_PATH.'/captcha/arial.ttf',
                            'imgDir'=>PUBLIC_PATH.'/captcha/',
                            'imgUrl'=>'/captcha/',
                            'wordLen' => 6,
                            'fsize'=>24,
                            'height'=>60,
                            'width'=>250,
                            'gcFreq'=>50,
                            'expiration' => 300
                        )
            ));
            
            $this->addElement($captcha);
        }
        
        
        
        
        
        $this->addElement('hidden', 'destino', array(
            'filters'    => array('StringTrim'),
        ));
        

        $this->addElement('submit', 'login2', array(
            'required' => false,
            'ignore'   => true,
            'label'    => 'Login',
        ));   
        
        

             
    }
}